<?
    include './common.php';
    $perPage = 5 ; 
    $pageN = $_POST['page'];
    $pageSt = ( $pageN - 1 ) * $perPage;
    $sql = "SELECT n.id AS `newId`, header,contents,typename,countryname,imgSrc,ptime FROM `news` AS n JOIN type AS t ON n.typeid = t.id JOIN country AS c ON n.countryid = c.id LIMIT {$pageSt},{$perPage}";
    $res = mysqli_query($link,$sql);
    $arr = [] ;
    while( $one = mysqli_fetch_assoc($res) ){
        $arr[] = $one ;
    }
    echo json_encode( $arr );
?>